﻿<?php
session_start();

$User = $_POST['txtEmail'];
$Pass = $_POST['txtPass'];



	
      $link = mysql_connect("localhost","root","")or die("Problemas en la conexion");
      mysql_select_db("personalizatuweb", $link);

      $result = mysql_query("SELECT * FROM administrador where EMAIL='".$User."' and PASS='".$Pass."'", $link) or die("Problemas en el la consulta SELECT:".mysql_error());
  

	  $CantResult = mysql_num_rows($result);
	  
	  if($CantResult > 0){
	  
		  while( $row = mysql_fetch_array($result)){
	   	  $_SESSION['CODIGO_ADM'] = $row['ID_ADMINISTRADOR'];
		  
				 }
				 mysql_close($link);  
				 header ("Location: IndexAdmin.php");	
		 }
	  else{

		 mysql_close($link); 
		 header ("Location: index.html?error=true");	
				
		}		 
		 
		  

?>